[PCI] back: Fix potential infinite loop in pcistub_match_one().
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 2 Aug 2006 08:15:26 +0000 (09:15 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Wed, 2 Aug 2006 08:15:26 +0000 (09:15 +0100)
The for loop in pcistub_match_one will loop forever if the
dev->bus->self links to itself at the uppermost bridge.  Adding a
check to prevent linking back in on itself prevents this.

Signed-off-by: Jon Mason <jdmason@us.ibm.com>
linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c

index aab9238c2d580f08c1a9ea10a8645fb7be74697e..b33855932de482cfc53bba5ae6b6ee6b25d510ac 100644 (file)
@@ -232,6 +232,10 @@ static int __devinit pcistub_match_one(struct pci_dev *dev,
                    && dev->bus->number == pdev_id->bus
                    && dev->devfn == pdev_id->devfn)
                        return 1;
+
+               /* Sometimes topmost bridge links to itself. */
+               if (dev == dev->bus->self)
+                       break;
        }
 
        return 0;